package cn.wolfcode.business.controller;

import cn.wolfcode.business.domain.vo.StatementItemVO;
import cn.wolfcode.business.service.IBusStatementItemService;
import cn.wolfcode.common.core.controller.BaseController;
import cn.wolfcode.common.core.domain.AjaxResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


@RestController
@RequestMapping("/business/item")
public class BusStatementItemController extends BaseController
{
    @Autowired
    private IBusStatementItemService busStatementItemService;

    @PostMapping
    public AjaxResult statementItemSave(@RequestBody StatementItemVO vo){
        return toAjax(busStatementItemService.save(vo));
    }

    @GetMapping
    public AjaxResult statementItemList(Long statementId){

        return AjaxResult.success(busStatementItemService.list(statementId));
    }

    @PatchMapping("/{statementId}")
    public AjaxResult pay(@PathVariable Long statementId){
        return toAjax(busStatementItemService.pay(statementId));
    }
}
